<template>
  <div class="demo-filters">
    <div class="row">
      <div class="label">姓名</div>
      <div class="value">{{ baseForm.name | desensitization(mask ? "name" : "none") }}</div>
    </div>
    <div class="row">
      <div class="label">性别</div>
      <div class="value">{{ baseForm.sex | getLabelByCodeFilter("SEX") }}</div>
    </div>
    <div class="row">
      <div class="label">民族</div>
      <div class="value">{{ baseForm.nation | getLabelByCodeFilter("NATION") }}</div>
    </div>
    <div class="row">
      <div class="label">身份证号</div>
      <div class="value">{{ baseForm.idCard | desensitization(mask ? "idCard" : "none") }}</div>
    </div>
    <div class="row">
      <div class="label">出生日期</div>
      <div class="value">{{ baseForm.birthday | formatDate("date") }}</div>
    </div>
    <div class="row">
      <div class="label">关注公众号日期</div>
      <div class="value">{{ baseForm.followDate | formatDate("datetime") }}</div>
    </div>
    <div class="row">
      <div class="label">手机号</div>
      <div class="value">{{ baseForm.mobile | desensitization(mask ? "mobile" : "none") }}</div>
    </div>
    <div class="row">
      <div class="label">所属地区</div>
      <div class="value">{{ baseForm.area | getTreeLabelByCodeFilter("CITY") }}</div>
    </div>
    <div class="row">
      <div class="label">居住地址</div>
      <div class="value">{{ baseForm.address | desensitization(mask ? "address" : "none") }}</div>
    </div>
    <div class="row">
      <div class="label">喜爱的颜色</div>
      <div class="value">{{ baseForm.colors | getLabelByCodesFilter("COLORS") }}</div>
    </div>
    <div class="row">
      <div class="label">喜爱的运动</div>
      <div class="value">{{ baseForm.sports | getLabelByCodesFilter("SPORTS") }}</div>
    </div>

    <div class="row">
      <div class="label">喜欢的地区</div>
      <div class="value">{{ baseForm.areaArr | getTreeLabelByCodesFilter("CITY") }}</div>
    </div>

    <div class="row">
      <div class="label">人物标签</div>
      <div class="value"><van-tag-dict v-for="(item, index) in baseForm.personTags" :key="index" dictType="PERSON_TAG" :value="item"></van-tag-dict></div>
    </div>

    <div class="btn-box">
      <van-button type="info" size="large" @click="mask=!mask">{{!mask ?  "脱 敏" : "不脱敏" }}</van-button>
    </div>
  </div>
</template>
<script>
export default {
  name: "demo",
  data() {
    return {
      mask: false, // 是否脱敏
      baseForm: {
        name: "沈小布", // 姓名
        sex: "0", // 性别
        nation: "1", // 民族
        idCard: "350624199905201314", // 身份证号
        birthday: "927177240000", // 出生年月日
        followDate: "Fri Jan 04 2013 13:14:00 GMT+0800 (中国标准时间)", // 关注日期
        mobile: "18885201314", // 手机号
        area: "35062400", // 所属地区
        address: "宁夏回族自治区桂花村5201314号", // 居住地址
        colors: ["2", "0"], // 喜爱的颜色
        sports: ["1", "2"], // 喜爱的运动
        areaArr: ["35062401", "35062302"],
        personTags: ["5", "2", "0"]
      }
    }
  },
  async created() {
  },
  methods: {

  }
}
</script>
<style scoped lang="less">
.demo-filters {
  padding: 16px;
  .row{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    line-height: 16px;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    padding: 12px 0;
    &:last-child {
      border: none;
    }
    .label {
      width: 120px;
      flex-shrink: 1;
    }
    .value {
      .van-tag {
        & +.van-tag {
          margin-left: 6px;
        }
      }
    }
  }
  .btn-box{
    margin-top: 100px;
  }
}

</style>